/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package model;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author Jirka
 */
@Entity
@Table(name = "player")
@NamedQueries({@NamedQuery(name = "Player.findAll", query = "SELECT p FROM Player p"), @NamedQuery(name = "Player.findByFirstName", query = "SELECT p FROM Player p WHERE p.firstName = :firstName"), @NamedQuery(name = "Player.findBySurname", query = "SELECT p FROM Player p WHERE p.surname = :surname"), @NamedQuery(name = "Player.findByPost", query = "SELECT p FROM Player p WHERE p.post = :post"), @NamedQuery(name = "Player.findByTechnique", query = "SELECT p FROM Player p WHERE p.technique = :technique"), @NamedQuery(name = "Player.findByStrength", query = "SELECT p FROM Player p WHERE p.strength = :strength"), @NamedQuery(name = "Player.findBySpeed", query = "SELECT p FROM Player p WHERE p.speed = :speed"), @NamedQuery(name = "Player.findByShot", query = "SELECT p FROM Player p WHERE p.shot = :shot"), @NamedQuery(name = "Player.findByPositionInCurrentTeam", query = "SELECT p FROM Player p WHERE p.positionInCurrentTeam = :positionInCurrentTeam"), @NamedQuery(name = "Player.findByNationality", query = "SELECT p FROM Player p WHERE p.nationality = :nationality"), @NamedQuery(name = "Player.findByGoalkeeping", query = "SELECT p FROM Player p WHERE p.goalkeeping = :goalkeeping"), @NamedQuery(name = "Player.findByAge", query = "SELECT p FROM Player p WHERE p.age = :age"), @NamedQuery(name = "Player.findByPlayerId", query = "SELECT p FROM Player p WHERE p.playerId = :playerId")})
public class Player implements Serializable {
    private static final long serialVersionUID = 1L;
    @Basic(optional = false)
    @Column(name = "first_name")
    private String firstName;
    @Basic(optional = false)
    @Column(name = "surname")
    private String surname;
    @Basic(optional = false)
    @Column(name = "post")
    private String post;
    @Basic(optional = false)
    @Column(name = "technique")
    private int technique;
    @Basic(optional = false)
    @Column(name = "strength")
    private int strength;
    @Basic(optional = false)
    @Column(name = "speed")
    private int speed;
    @Basic(optional = false)
    @Column(name = "shot")
    private int shot;
    @Column(name = "position_in_current_team")
    private String positionInCurrentTeam;
    @Basic(optional = false)
    @Column(name = "nationality")
    private String nationality;
    @Basic(optional = false)
    @Column(name = "goalkeeping")
    private int goalkeeping;
    @Column(name = "age")
    private Integer age;
    @Id
    @Basic(optional = false)
    @Column(name = "player_id")
    @GeneratedValue(strategy=GenerationType.SEQUENCE)
    private Integer playerId;
    @JoinColumn(name = "club_id", referencedColumnName = "club_id")
    @ManyToOne
    private Club club;
    @OneToMany(mappedBy = "player")
    private Collection<Offer> offerCollection;
    @OneToMany(mappedBy = "author")
    private Collection<Event> eventCollection;

    public Player() {
    }

    public Player(Integer playerId) {
        this.playerId = playerId;
    }

    public Player(Integer playerId, String firstName, String surname, String post, int technique, int strength, int speed, int shot, String nationality, int goalkeeping) {
        this.playerId = playerId;
        this.firstName = firstName;
        this.surname = surname;
        this.post = post;
        this.technique = technique;
        this.strength = strength;
        this.speed = speed;
        this.shot = shot;
        this.nationality = nationality;
        this.goalkeeping = goalkeeping;
    }

    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    public String getSurname() {
        return surname;
    }

    public void setSurname(String surname) {
        this.surname = surname;
    }

    public String getPost() {
        return post;
    }

    public void setPost(String post) {
        this.post = post;
    }

    public int getTechnique() {
        return technique;
    }

    public void setTechnique(int technique) {
        this.technique = technique;
    }

    public int getStrength() {
        return strength;
    }

    public void setStrength(int strength) {
        this.strength = strength;
    }

    public int getSpeed() {
        return speed;
    }

    public void setSpeed(int speed) {
        this.speed = speed;
    }

    public int getShot() {
        return shot;
    }

    public void setShot(int shot) {
        this.shot = shot;
    }

    public String getPositionInCurrentTeam() {
        return positionInCurrentTeam;
    }

    public void setPositionInCurrentTeam(String positionInCurrentTeam) {
        this.positionInCurrentTeam = positionInCurrentTeam;
    }

    public String getNationality() {
        return nationality;
    }

    public void setNationality(String nationality) {
        this.nationality = nationality;
    }

    public int getGoalkeeping() {
        return goalkeeping;
    }

    public void setGoalkeeping(int goalkeeping) {
        this.goalkeeping = goalkeeping;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public Integer getPlayerId() {
        return playerId;
    }

    public void setPlayerId(Integer playerId) {
        this.playerId = playerId;
    }

    public Club getClub() {
        return club;
    }

    public void setClub(Club club) {
        this.club = club;
    }

    public Collection<Offer> getOfferCollection() {
        return offerCollection;
    }

    public void setOfferCollection(Collection<Offer> offerCollection) {
        this.offerCollection = offerCollection;
    }

    public Collection<Event> getEventCollection() {
        return eventCollection;
    }

    public void setEventCollection(Collection<Event> eventCollection) {
        this.eventCollection = eventCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (playerId != null ? playerId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Player)) {
            return false;
        }
        Player other = (Player) object;
        if ((this.playerId == null && other.playerId != null) || (this.playerId != null && !this.playerId.equals(other.playerId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "model.Player[playerId=" + playerId + "]";
    }

}
